package archer.framework.common.repository.page;


import archer.framework.common.ArcherCommonModule;

import java.util.ArrayList;
import java.util.List;

/**
 * 分页结果
 */
public class PageInfo {

    /**
     * 当前第几页
     */
    private int pageIndex = ArcherCommonModule.defaultPageIndex;

    /**
     * 分页大小
     */
    private int pageSize = ArcherCommonModule.defaultPageSize;

    /**
     * 当前页开始行
     */
    private int startRow;

    /**
     * 当前页结束行
     */
    private int endRow;

    /**
     * 总条数
     */
    private long total;

    /**
     * 总页数
     */
    private long pages;

    private boolean hasPrev;

    private boolean hasNext;

    /**
     * 分页数据
     */
    private List rows = new ArrayList();


    //-------------------------------- getter setter -----------------------------------
    public int getPageIndex() {
        return pageIndex;
    }

    public PageInfo setPageIndex(int pageIndex) {
        this.pageIndex = pageIndex;
        return this;
    }

    public int getPageSize() {
        return pageSize;
    }

    public PageInfo setPageSize(int pageSize) {
        this.pageSize = pageSize;
        return this;
    }

    public int getStartRow() {
        return startRow;
    }

    public PageInfo setStartRow(int startRow) {
        this.startRow = startRow;
        return this;
    }

    public int getEndRow() {
        return endRow;
    }

    public PageInfo setEndRow(int endRow) {
        this.endRow = endRow;
        return this;
    }

    public long getTotal() {
        return total;
    }

    public PageInfo setTotal(long total) {
        this.total = total;
        return this;
    }

    public long getPages() {
        return pages;
    }

    public PageInfo setPages(long pages) {
        this.pages = pages;
        return this;
    }

    public List getRows() {
        return rows;
    }

    public PageInfo setRows(List rows) {
        this.rows = rows;
        return this;
    }

    public boolean isHasPrev() {
        return hasPrev;
    }

    public PageInfo setHasPrev(boolean hasPrev) {
        this.hasPrev = hasPrev;
        return this;
    }

    public boolean isHasNext() {
        return hasNext;
    }

    public PageInfo setHasNext(boolean hasNext) {
        this.hasNext = hasNext;
        return this;
    }
}
